#include<pthread.h>
#include<string>
#include<ctime>
#include<iostream>
using namespace std;
typedef void (*func_)(int,int);

static int num=1;

class Thread
{
private:
    static void *Hovt(void *args)
    {
        Thread*td=static_cast<Thread*>(args);
        td->Entry();
        return nullptr;
    }
public:  
    Thread(func_ fun,int a=0,int b=0)
            :tid_(0),name_(""),start_timestamp_(0),isrunning_(false),fun_(fun),a_(a),b_(b)
    {}
    void Run()
    {
        name_="Thread"+std::to_string(num+1);
        start_timestamp_=time(nullptr);
        isrunning_=true;
        pthread_create(&tid_,nullptr,Hovt,this);
    }
    bool isrunning()
    {
        return isrunning_;
    }
    uint64_t Start_timestamp_(){
        return start_timestamp_;
    }
    void Entry(){
        if(isrunning_){
            fun_(a_,b_);
        }
    }
    void join(){
        pthread_join(tid_,nullptr);
        isrunning_=false;
    }
    ~Thread(){}
private:
    pthread_t tid_;
    std::string name_;
    uint64_t start_timestamp_;
    bool isrunning_;
    func_ fun_;
    int a_;
    int b_;
};